// 泛型约束
interface LengthObj {
    length: number
}

function logLen<T extends LengthObj>(obj: T) {
    console.log(obj.length);

}
logLen<Array<number>>(([1, 2, 3]))
logLen<string>('sdfdsf')